#include<iostream>  
#include<stdio.h>
#include<map>  
#include<string>  
using namespace std;  
int main(){
	int i,K,mileage,count;
	char number[19];
	map<string,int>airplan;
	scanf("%d%d",&count,&K);
	for(i=0;i<count;i++){
		scanf("%s%d",number,&mileage);
		if(!airplan.count(number))
			airplan[number]=0;
		if(mileage<K)
			mileage=K;
		airplan[number]=airplan[number]+mileage;
	}
	cin>>count;
	while(count--){
		scanf("%s",&number);
		if(airplan.count(number)) printf("%d\n",airplan[number]);
		else printf("No Info\n");
	} 
	
	return 0;
} 
